//***************************************************************************
//
// BAC FingerPrint Reader Software Subsystem Java Demo  
//
// This module contains the demo code to Java wrapper of the 
// Fingerprint Software Subsystem.
//
//
// (C) Copyright 1997 Biometric Access Corporation. All rights reserved.   
//
//***************************************************************************
package com.ipharma.interfaces.fingerprint;

import java.awt.Button;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.GridLayout;
import java.awt.Label;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class FPErrMsg extends Dialog
{
  Label  errMsg;
  Label  errCode;
  Button okButton;

  public FPErrMsg()
  {
    super( new Frame(), "Exception Occurred" );
    setLayout( new GridLayout( 3, 1 ) );
    errMsg = new Label( "", Label.CENTER );
    errCode = new Label( "", Label.CENTER );
    okButton = new Button( "OK" );
    okButton.addActionListener( new ActionListener() {
      public void actionPerformed( ActionEvent evt )
      {
        setVisible( false );
      }
    });
    add( errMsg, "1" );
    add( errCode, "2" );
    add( okButton, "3" );
    setBounds( 0, 0, 600, 120 );
  }

  public void displayException( String msg, int code )
  {
    if ( code < 0 )
    {
      errMsg.setText( "Error Message: " + msg );
      errCode.setText( "Error Code: " + code );
      setVisible( true );
    }
  }
}
